Skip to content

fix(fleet/dispatch-test): mark dispatched only after the dispatch succeeds (#6598) - #6721

Merged
dezren39 merged 1 commit into
mainfrom
queue/6598-dispatch-order
Nov 7, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/6598-dispatch-order

Conversation

@dezren39

@dezren39 dezren39 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

What

Fixes issue #6598: fleet dispatch-test submit marked the job row dispatched before the dispatch call, so any failure in that window — a workflow without the workflow_dispatch trigger (422), a missing workflow file (404), a repo body with no default_branch, a transport error — left a permanently lying row: status reported dispatched forever for a job whose workflow never started, indistinguishable from a real in-flight job.

Change (one file: pkgs/fleet/crates/fleet-dispatch-test/src/lib.rs)

The submit tail is split into three steps, run in order through a small run_dispatch_sequence helper:

  1. Record the target — UPDATE jobs SET target_repo = ?, updated_at = ? with the status left queued (recording the chosen execution home is truthful at this point);
  2. Dispatch — fetch the copy's default_branch, then POST the workflow dispatch;
  3. Mark dispatched — UPDATE jobs SET status = 'dispatched' only after the dispatch succeeds.

Any step failing stops the sequence and propagates the error, so a failed dispatch leaves the row queued with its target recorded — the same truthful, retryable state as the existing no-eligible-scope outcome, whose behaviour is unchanged. The submit usage text now describes the truthful order.

Verification

  • cargo test -p fleet-dispatch-test on the laptop: 16/16 pass, including three new regression tests that pin the contract at the exact seam verb_submit calls:
    • order is target → dispatch → mark on success;
    • a dispatch failure (the 422 shape) never reaches the mark step and the error propagates;
    • a target-write failure stops before dispatch.
  • cargo check -p fleet (the consuming binary crate) passes.
  • The bug itself was confirmed twice independently before this fix: the filing run's stub-GitHub/stub-store probe (422 → final stored status dispatched, no corrective write) and lane code-k's fresh read of verb_submit on current main during triage.

Fixes #6598.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ceeds

Issue #6598: verb_submit UPDATEed the job row to status=dispatched before fetching default_branch and POSTing the workflow dispatch, so every failure in that window (422 no workflow_dispatch trigger, 404, transport error) left a permanently lying row that status reported as dispatched forever. Split the write: record target_repo with the row still queued, dispatch, and only then mark dispatched. The three steps run through a small run_dispatch_sequence helper so unit tests pin the contract: order is target -> dispatch -> mark, a dispatch failure never reaches the mark step, and a target-write failure stops before dispatch. The no-eligible-scope behaviour (row remains queued) is unchanged; a failed dispatch now lands in that same truthful, retryable state. fleet-dispatch-test 16/16 tests pass; cargo check -p fleet passes.
@dezren39
dezren39 requested a review from a team as a code owner November 7, 2026 03:15
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T03:16:51.166511Z 105207e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 17968d8e-8fad-4d13-be58-22804127c6b2
Commits

Reviewing files that changed from the base of the PR and between 348f900 and 105207e.

Files selected for processing: 1

  • pkgs/fleet/crates/fleet-dispatch-test/src/lib.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fleet(dispatch-test): submit marks the job dispatched before the dispatch call — a failed dispatch leaves a permanently lying row

1 participant